unit Xft;

interface

uses
	x, xlib, xrender;

const
	libXft = 'libXft';

type
	PXftFont = ^TXftFont;
	TXftFont =  record
		ascent            : longint;
		descent           : longint;
		height            : longint;
		max_advance_width : longint;
		charset           : Pointer;
		pattern           : Pointer;
	end;

	PXftDraw = Pointer;

	PXRenderColor = ^TXRenderColor;
	TXRenderColor = record
		red   : word;
		green : word;
		blue  : word;
		alpha : word;
	end;

	PXftColor  = ^TXftColor;
	TXftColor =  record
		pixel : dword;
		color : TXRenderColor;
	end;

function XftInitFtLibrary : LongBool; cdecl; external libxft;
//function XftListFonts(dpy : PDisplay; screen : longint; args : array of const) : PFcFontSet; cdecl; external libXft;
//function XftFontOpenPattern(dpy : PDisplay; pattern : PFcPattern) : PXftFont; cdecl; external libXft;
function XftFontOpenName(dpy: PDisplay; screen: Integer; name: AnsiString): PXftFont; cdecl; external libXft;
procedure XftFontClose(dpy : PDisplay; pub : PXftFont); cdecl; external libXft;
//function XftFontMatch(dpy : PDisplay; screen : longint; pattern : PFcPattern; result : PFcResult) : PFcPattern; cdecl; external libXft;
function XftCharExists(dpy : PDisplay; pub : PXftFont; ucs4 : DWORD) : LongBool; cdecl; external libXft;
procedure XftTextExtents16(dpy : PDisplay; pub : PXftFont; _string : PByte; len : longint; extents : PXGlyphInfo); cdecl; external libXft;
procedure XftDrawString16(draw : PXftDraw; color : PXftColor; pub : PXftFont; x, y:longint; _string : PByte; len : longint); cdecl; external libXft;

function XftColorAllocValue(dpy : PDisplay; visual : PVisual; cmap : TColormap; color : PXRenderColor; result : PXftColor) : LongBool; cdecl; external libXft;
procedure XftColorFree(dpy : PDisplay; visual : PVisual; cmap : TColormap; color : PXftColor); cdecl; external libXft;
function XftDrawCreate(dpy : PDisplay; drawable : TDrawable; visual : PVisual; colormap : TColormap) : PXftDraw; cdecl; external libXft;
procedure XftDrawDestroy(draw : PXftDraw); cdecl; external libXft;
procedure XftDrawRect(draw : PXftDraw; color : PXftColor; x, y : longint; width, height : dword); cdecl; external libXft;

implementation

end.
